package kosta.model.board.file;

import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class FileBoardDaoImpl implements FileBoardDao {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public List<FileBoardVO> getListBoard() throws SQLException {
		return this.sqlSessionTemplate.selectList("fileboard.getListBoard");
	}

	@Override
	public FileBoardVO findByNo(int no) throws SQLException {
		return this.sqlSessionTemplate.selectOne("fileboard.findByNo", no);
	}

	@Override
	public int insertBoard(FileBoardVO fvo) throws SQLException {
		return this.sqlSessionTemplate.insert("fileboard.insertBoard", fvo);
	}

	@Override
	public void updateBoard(FileBoardVO bvo) throws SQLException {
		this.sqlSessionTemplate.update("fileboard.updateBoard", bvo);
	}

	@Override
	public void deleteBoard(int fileNo) throws SQLException {
		this.sqlSessionTemplate.delete("fileboard.deleteBoard", fileNo);
	}

	@Override
	public void updateCount(FileBoardVO vo) throws SQLException {
		this.sqlSessionTemplate.update("fileboard.updateCount",vo);
	}

	@Override
	public List<FileBoardVO> findById(String id) throws SQLException {
		return null;
	}

	@Override
	public List<FileBoardVO> findByTitle(String title) throws SQLException {
		return null;
	}

	@Override
	public void deleteUploadFile(FileBoardVO vo) throws SQLException {
		this.sqlSessionTemplate.update("fileboard.deleteUploadFile", vo);
	}

	@Override
	public void pointPlus(String fileWriter) throws SQLException {
		this.sqlSessionTemplate.update("fileboard.pointPlus", fileWriter);
	}
}
